package com.woniu.apiImpl;

import com.woniu.api.HisCaseQueryApi;
import com.woniu.dto.HisCaseDto;
import com.woniu.dto.PageDTO;
import com.woniu.param.AddHisCaseParam;
import com.woniu.param.ListHisCaseParam;
import com.woniu.param.ModifyHisCaseParam;
import com.woniu.param.ModifyStatusHisCaseParam;
import com.woniu.service.HisCaseService;
import com.woniu.util.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.sound.midi.Soundbank;
import java.util.ArrayList;
import java.util.List;

@RestController

public class HisCaseQueryApiImpl implements HisCaseQueryApi {
    @Resource
    private HisCaseService hisCaseService;
    @Override
    public Result<HisCaseDto> generateMedicalRecords(AddHisCaseParam addHisCaseParam) {
        HisCaseDto hisCaseDto = hisCaseService.generateMedicalRcords(addHisCaseParam);

        return Result.bulid(HisCaseDto.class).setCode(200).setFlag(true).setMessage("新增成功").setData(hisCaseDto);
    }

    @Override
    public Result<HisCaseDto> modifyMedicalRecords(ModifyHisCaseParam modifyHisCaseParam) {
        HisCaseDto hisCaseDto = hisCaseService.modifyMedicalRecord(modifyHisCaseParam);


        return Result.bulid(hisCaseDto);
    }

    @Override
    public Result<HisCaseDto> modifyMedicalRecordStatus(ModifyStatusHisCaseParam modifyStatusHisCaseParam) {
        HisCaseDto hisCaseDto = hisCaseService.modifyMedicalRecordStatus(modifyStatusHisCaseParam);
        return Result.bulid(hisCaseDto);
    }

    @Override
    public Result<Boolean> deleteMedicalRecord(ArrayList<Integer> ids) {

        Boolean aBoolean = hisCaseService.deleteMedicalRecord(ids);
        return Result.bulid(Boolean.class).setData(aBoolean).setCode(200).setMessage("删除成功").setFlag(true);

    }

    @Override
    public Result<PageDTO<HisCaseDto>> queryMedicalRecords(ListHisCaseParam listHisCaseParam) {
        PageDTO<HisCaseDto> hisCaseDtoPageDTO = hisCaseService.queryMedicalRecords(listHisCaseParam);
        return Result.bulid(hisCaseDtoPageDTO);
    }
}
